#!/bin/bash
clear
if [[ "$EUID" -ne 0 ]]; then
    echo -e "\033[1;31mScript need to be run as root!\033[0m"; exit 1
fi

dependencies=(perl libnet-ssleay-perl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions)
for pkg in "${dependencies[@]}"; do
    apt-get -y -qq install $pkg
done

wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
echo 'deb http://download.webmin.com/download/repository sarge contrib' | tee /etc/apt/sources.list.d/webmin.list

apt-get -qq update
apt-get -y -qq install webmin

sed -i "s|ssl=1|ssl=0|g" /etc/webmin/miniserv.conf
sed -i "s|ipv6=1|ipv6=0|g" /etc/webmin/miniserv.conf
systemctl restart webmin

echo
echo -e "\033[1;32mCongratulation, We are done with the webmin installation.\033[0m"
echo
echo 'Use my referral link https://m.do.co/c/a28a40414d6a'
echo 'to gets $100 credit into your DigitalOcean account.'
echo 'Created by Doctype, Powered by Cybertize'
echo 'Copyright 2021, Allright reserved.'
echo; sleep 5
